package scottb.flex;

import java.awt.*;

public class HGroup extends FlexPanel {

    private Integer paddingTop;
    private Integer paddingRight;
    private Integer paddingBottom;
    private Integer paddingLeft;
    private Integer gap;
    private VAlign align = VAlign.TOP;

    public HGroup(Component...components) {

        setLayout(new HGroupLayoutManager());
        setOpaque(false);

        for(Component c : components) {
            add(c);
        }
    }

    public HGroup padding(Integer padding) {

        paddingTop = padding;
        paddingRight = padding;
        paddingBottom = padding;
        paddingLeft = padding;

        return this;
    }

    public HGroup padding(Integer vPadding, Integer hPadding) {

        paddingTop = vPadding;
        paddingRight = hPadding;
        paddingBottom = vPadding;
        paddingLeft = hPadding;

        return this;
    }

    public HGroup padding(Integer top, Integer right, Integer bottom, Integer left) {

        paddingTop = top;
        paddingRight = right;
        paddingBottom = bottom;
        paddingLeft = left;

        return this;
    }

    public HGroup paddingTop(Integer padding) {

        paddingTop = padding;

        return this;
    }

    public HGroup paddingRight(Integer padding) {

        paddingRight = padding;

        return this;
    }

    public HGroup paddingBottom(Integer padding) {

        paddingBottom = padding;

        return this;
    }

    public HGroup paddingLeft(Integer padding) {

        paddingLeft = padding;

        return this;
    }

    public Integer paddingTop() {
        return paddingTop;
    }

    public Integer paddingRight() {
        return paddingRight;
    }

    public Integer paddingBottom() {
        return paddingBottom;
    }

    public Integer paddingLeft() {
        return paddingLeft;
    }

    public HGroup gap(Integer gap) {

        this.gap = gap;

        return this;
    }

    public Integer gap() {

        return gap;
    }

    public HGroup align(VAlign align) {

        this.align = align;

        return this;
    }

    public HGroup align(String align) {

        this.align = VAlign.lookup(align);

        return this;
    }

    public VAlign align() {

        return align;
    }

    // Layout and size

    public HGroup top(Integer top) {
        super.top(top);
        return this;
    }

    public HGroup left(Integer left) {
        super.left(left);
        return this;
    }

    public HGroup right(Integer right) {
        super.right(right);
        return this;
    }

    public HGroup bottom(Integer bottom) {
        super.bottom(bottom);
        return this;
    }

    public HGroup horizontalCenter(Integer center) {
        super.horizontalCenter(center);
        return this;
    }

    public HGroup verticalCenter(Integer center) {
        super.verticalCenter(center);
        return this;
    }

    public HGroup center() {
        super.center();
        return this;
    }

    public HGroup width(Integer width) {
        super.width(width);
        return this;
    }

    public HGroup height(Integer height) {
        super.height(height);
        return this;
    }

    // BACKGROUND

    public HGroup background(Color color) {

        super.background(color);

        return this;
    }

    public HGroup background(Integer color) {

        super.background(color);

        return this;
    }

    public HGroup backgroundAlpha(Float alpha) {

        super.backgroundAlpha(alpha);

        return this;
    }

    public HGroup backgroundAlpha(Double alpha) {

        super.backgroundAlpha(alpha);

        return this;
    }

    public HGroup gradient2(Integer color1, Integer color2) {

        super.gradient2(color1, color2);

        return this;
    }

    public HGroup gradient2(Color color1, Integer color2) {

        super.gradient2(color1, color2);

        return this;
    }

    public HGroup gradient2(Integer color1, Color color2) {

        super.gradient2(color1, color2);

        return this;
    }

    public HGroup gradient2(Color color1, Color color2) {

        super.gradient2(color1, color2);

        return this;
    }

    // BORDER

    public HGroup borderColor(Integer color) {

        super.borderColor(color);

        return this;
    }

    public HGroup borderColor(Color color) {

        super.borderColor(color);

        return this;
    }

    public HGroup borderWeight(Integer weight) {

        super.borderWeight(weight);

        return this;
    }

    public HGroup border(Integer color) {

        super.border(color);

        return this;
    }

    public HGroup border(Color color) {

        super.border(color);

        return this;
    }

    public HGroup border(Integer color, Integer weight) {

        super.border(color, weight);

        return this;
    }

    public HGroup border(Color color, Integer weight) {

        super.border(color, weight);

        return this;
    }

    public HGroup border(Integer color, Integer weight, Integer radius) {

        super.border(color, weight, radius);

        return this;
    }


    public HGroup cornerRadius(Integer radius) {

        super.cornerRadius(radius);

        return this;
    }

    public HGroup cornerRadius(Integer topLeft, Integer topRight, Integer bottomLeft, Integer bottomRight) {

        super.cornerRadius(topLeft, topRight, bottomLeft, bottomRight);

        return this;
    }
    
    // ADD CHILDREN
    public HGroup add(Component c) {
        super.add(c);
        return this;
    }
}
